package com.qcby.service.impl;

import com.qcby.dao.InformationOverviewDao;
import com.qcby.entity.InformationOverview.CheckingScriptCount;
import com.qcby.entity.InformationOverview.ShopTag;
import com.qcby.entity.InformationOverview.TOP5Chart;
import com.qcby.entity.InformationOverview.TOPChartDTO;
import com.qcby.entity.Shop;
import com.qcby.service.InformationOverviewService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class InformationOverviewServiceImpl implements InformationOverviewService {
    @Autowired
    private InformationOverviewDao informationOverviewDao;
    @Override
    public Integer userCount() {
        return informationOverviewDao.userCount();
    }

    @Override
    public Integer shopCount() {
        return informationOverviewDao.shopCount();
    }

    @Override
    public Integer checkingsCount() {
        return informationOverviewDao.checkingsCount();
    }

    @Override
    public Integer auditCount() {
        return informationOverviewDao.auditCount();
    }

    @Override
    public Integer scriptCount() {
        return informationOverviewDao.scriptCount();
    }

    @Override
    public Integer tagCount() {
        return informationOverviewDao.tagCount();
    }

    @Override
    public TOPChartDTO TOP5Chart() {
        List<TOP5Chart> list = informationOverviewDao.TOP5Chart();
        TOPChartDTO toplist = new TOPChartDTO();
        toplist.setCountList(new ArrayList<>());
        toplist.setNameList(new ArrayList<>());
        for(TOP5Chart top:list){
            toplist.getCountList().add(top.getCount());
            toplist.getNameList().add(top.getName());
        }
        return toplist;
    }

    @Override
    public List<ShopTag> ShopTag() {
        return informationOverviewDao.shopTag();
    }

    @Override
    public List<CheckingScriptCount> CheckingScriptCount() {
        return informationOverviewDao.CheckingScriptCount();
    }

    @Override
    public List<TOP5Chart> UserTOP5Count() {
        return informationOverviewDao.UserTOP5Count();
    }

    @Override
    public List<Shop> getAllShops(Double rating) {
        return informationOverviewDao.getAllShops(rating);
    }


}
